﻿namespace Vin.Extension.Redis.Models;

public enum RedisKeyRule
{
    // 默认
    Normal = 0,
    // 大驼峰
    CamelCase = 1,
    // 小驼峰
    LowerCamelCase = 2,
    // 下划线
    UnderLine = 3,
    // 中划线
    MiddleLine = 4,
}

public class RedisOption
{
    /// <summary>
    /// ip地址
    /// </summary>
    public string Host { get; set; } = "127.0.0.1";

    /// <summary>
    /// 端口
    /// </summary>
    public string Port { get; set; } = "6379";

    /// <summary>
    /// 启用SSL
    /// </summary>
    public bool Ssl { get; set; } = false;

    /// <summary>
    /// 用户名
    /// </summary>
    public string User { get; set; } = string.Empty;

    /// <summary>
    /// 密码
    /// </summary>
    public string Password { get; set; } = string.Empty;

    /// <summary>
    /// 前缀
    /// </summary>
    public string Prefix { get; set; } = string.Empty;

    /// <summary>
    /// 其他
    /// </summary>
    public string OtherString { get; set; } = string.Empty;

    // /// <summary>
    // /// 开启的数据库
    // /// </summary>
    // public List<int>? Dbs { get; set; }

    /// <summary>
    /// 替换默认缓存
    /// </summary>
    public bool DefaultCache { get; set; } = false;

    /// <summary>
    /// 默认的数据库
    /// </summary>
    public int DefaultDb { get; set; } = 0;

    /// <summary>
    /// 子节点
    /// </summary>
    public List<RedisOption> NodeOptions { get; set; } = [];
    
    /// <summary>
    /// Key的命名规则
    /// </summary>
    public RedisKeyRule KeyRule { get; set; } = RedisKeyRule.Normal;
}